home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / System / PPCReleaseDEV / Libmfd / math.h.68040 < prev    next >
Encoding:
Text File  |  1998-02-21  |  7.7 KB  |  247 lines

  1. /*
  2.  * Copyright (c) 1985, 1990 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)math.h    5.8 (Berkeley) 4/2/91
  34.  */
  35.  
  36. #ifndef    _MATH_H_
  37. #define    _MATH_H_
  38.  
  39. #include <float.h>
  40.  
  41. #ifndef BITS
  42. #define BITS(type)    (8 * (int)sizeof(type))
  43. #endif
  44.  
  45. #define    M_E        2.7182818284590452354    /* e */
  46. #define    M_LOG2E        1.4426950408889634074    /* log 2e */
  47. #define    M_LOG10E    0.43429448190325182765    /* log 10e */
  48. #define    M_LN2        0.69314718055994530942    /* log e2 */
  49. #define    M_LN10        2.30258509299404568402    /* log e10 */
  50. #define    M_PI        3.14159265358979323846    /* pi */
  51. #define    M_PI_2        1.57079632679489661923    /* pi/2 */
  52. #define    M_PI_4        0.78539816339744830962    /* pi/4 */
  53. #define    M_1_PI        0.31830988618379067154    /* 1/pi */
  54. #define    M_2_PI        0.63661977236758134308    /* 2/pi */
  55. #define    M_2_SQRTPI    1.12837916709551257390    /* 2/sqrt(pi) */
  56. #define    M_SQRT2        1.41421356237309504880    /* sqrt(2) */
  57. #define    M_SQRT1_2    0.70710678118654752440    /* 1/sqrt(2) */
  58.  
  59. #include <sys/cdefs.h>
  60.  
  61. enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
  62.  
  63. #define _LIB_VERSION_TYPE enum fdversion
  64. #define _LIB_VERSION _fdlib_version  
  65.  
  66. /* if global variable _LIB_VERSION is not desirable, one may 
  67.  * change the following to be a constant by: 
  68.  *    #define _LIB_VERSION_TYPE const enum version
  69.  * In that case, after one initializes the value _LIB_VERSION (see
  70.  * s_lib_version.c) during compile time, it cannot be modified
  71.  * in the middle of a program
  72.  */ 
  73. __BEGIN_DECLS
  74.  _LIB_VERSION_TYPE  _LIB_VERSION;
  75. __END_DECLS
  76.  
  77. #define _IEEE_  fdlibm_ieee
  78. #define _SVID_  fdlibm_svid
  79. #define _XOPEN_ fdlibm_xopen
  80. #define _POSIX_ fdlibm_posix
  81.  
  82. struct exception {
  83.     int type;
  84.     char *name;
  85.     double arg1;
  86.     double arg2;
  87.     double retval;
  88. };
  89.  
  90. /* 
  91.  * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
  92.  * (one may replace the following line by "#include <values.h>")
  93.  */
  94.  
  95. #define X_TLOSS        1.41484755040568800000e+16 
  96.  
  97. #define    DOMAIN        1
  98. #define    SING        2
  99. #define    OVERFLOW    3
  100. #define    UNDERFLOW    4
  101. #define    TLOSS        5
  102. #define    PLOSS        6
  103.  
  104. __BEGIN_DECLS
  105. int matherr __P((struct exception *));
  106.  
  107. int signgam;
  108.  
  109. double erf __P((double));
  110. double erfc __P((double));
  111. double gamma __P((double));
  112. int isnan __P((double));
  113. int finite __P((double));
  114. double j0 __P((double));
  115. double j1 __P((double));
  116. double jn __P((int, double));
  117. double lgamma __P((double));
  118. double y0 __P((double));
  119. double y1 __P((double));
  120. double yn __P((int, double));
  121. double acosh __P((double));
  122. double asinh __P((double));
  123. double cbrt __P((double));
  124. double nextafter __P((double, double));
  125. double remainder __P((double, double));
  126. double significand __P((double));
  127. double copysign __P((double, double));
  128. int ilogb __P((double));
  129. double scalbn __P((double, int));
  130. /*
  131.  * Reentrant version of gamma & lgamma; passes signgam back by reference
  132.  * as the second argument; user must allocate space for signgam.
  133.  */
  134. #ifdef _REENTRANT
  135. double gamma_r __P((double, int *));
  136. double lgamma_r __P((double, int *));
  137. #endif    /* _REENTRANT */
  138.  
  139. /* ieee style elementary functions */
  140. double __ieee754_sqrt __P((double));            
  141. double __ieee754_acos __P((double));            
  142. double __ieee754_acosh __P((double));            
  143. double __ieee754_log __P((double));            
  144. double __ieee754_atanh __P((double));            
  145. double __ieee754_asin __P((double));            
  146. double __ieee754_atan2 __P((double,double));            
  147. double __ieee754_exp __P((double));
  148. double __ieee754_cosh __P((double));
  149. double __ieee754_fmod __P((double,double));
  150. double __ieee754_pow __P((double,double));
  151. double __ieee754_lgamma_r __P((double,int *));
  152. double __ieee754_gamma_r __P((double,int *));
  153. double __ieee754_lgamma __P((double));
  154. double __ieee754_gamma __P((double));
  155. double __ieee754_log10 __P((double));
  156. double __ieee754_sinh __P((double));
  157. double __ieee754_hypot __P((double,double));
  158. double __ieee754_j0 __P((double));
  159. double __ieee754_j1 __P((double));
  160. double __ieee754_y0 __P((double));
  161. double __ieee754_y1 __P((double));
  162. double __ieee754_jn __P((int,double));
  163. double __ieee754_yn __P((int,double));
  164. double __ieee754_remainder __P((double,double));
  165. int    __ieee754_rem_pio2 __P((double,double*));
  166. #define _SCALB_INT
  167. #ifdef _SCALB_INT
  168. double __ieee754_scalb __P((double,int));
  169. #else
  170. double __ieee754_scalb __P((double,double));
  171. #endif
  172.  
  173. /* fdlibm kernel function */
  174. double __kernel_standard __P((double,double,int));    
  175. double __kernel_sin __P((double,double,int));
  176. double __kernel_cos __P((double,double));
  177. double __kernel_tan __P((double,double,int));
  178. int    __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
  179. __END_DECLS
  180.  
  181. #if (defined(__GNUC__) || defined(__cplusplus)) && defined(__HAVE_68881__)
  182. #include <math-68881.h>
  183. #else
  184. #if (defined(__GNUC__) || defined(__cplusplus)) && defined(mc68040)
  185. #include <math-68040.h>
  186. #else
  187.  
  188. #define    HUGE_VAL    1e500            /* IEEE: positive infinity */
  189.  
  190. /*
  191.  * ANSI/POSIX
  192.  */
  193.  
  194. #define    HUGE    ((float)3.40282346638528860e+38)
  195.  
  196. __BEGIN_DECLS
  197. double acos __P((double));
  198. double asin __P((double));
  199. double atan __P((double));
  200. double atan2 __P((double, double));
  201. double cos __P((double));
  202. double sin __P((double));
  203. double tan __P((double));
  204. double cosh __P((double));
  205. double sinh __P((double));
  206. double tanh __P((double));
  207. double exp __P((double));
  208. double frexp __P((double, int *));
  209. double ldexp __P((double, int));
  210. double log __P((double));
  211. double log10 __P((double));
  212. double modf __P((double, double *));
  213. double pow __P((double, double));
  214. double sqrt __P((double));
  215. double ceil __P((double));
  216. double fabs __P((double));
  217. double floor __P((double));
  218. double fmod __P((double, double));
  219. double hypot __P((double, double));
  220. double atanh __P((double));
  221. double logb __P((double));
  222. #ifdef _SCALB_INT
  223. double scalb __P((double, int));
  224. #else
  225. double scalb __P((double, double));
  226. #endif
  227. double rint __P((double));
  228. double expm1 __P((double));
  229. double log1p __P((double));
  230. __END_DECLS
  231.  
  232. #endif /* mc68040 */
  233. #endif /* __HAVE_68881__ */
  234.  
  235. __BEGIN_DECLS
  236. /* These functions are defined in ixemul */
  237. int     isinf __P((double));
  238. int     isnan __P((double));
  239. /* This function had a different name in the old libm.a */
  240. #define drem remainder
  241. /* These functions are missing from the library, but were defined
  242.    in the older libm.a */
  243. double  cabs();        /* we can't describe cabs()'s argument properly */
  244. __END_DECLS
  245.  
  246. #endif /* _MATH_H_ */
  247.